/**
  * @file: Water.h
  * @author: Adrian Johnston and Steven Hobson-Campbell
  */

#ifndef WATER_H
#define WATER_H


#include <GL/glew.h>
#include <SFML/Graphics.hpp>
#include <SFML/OpenGL.hpp>
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <iostream>
#include <cmath>
#include <list>
#include "Structures.h"

class Water {
public:
    Water(std::string wFilename, GLuint shaderProg);
	~Water();
	void load();	//Will load the Water into a VBO
	void setScale(GLfloat x, GLfloat y, GLfloat z);
    void setPosition(GLfloat x, GLfloat y, GLfloat z);
    void render(vec3 camPos); //Will render the Water
	std::string getHMFileName(); //Returns the path to the current filename
	GLfloat timeCounter;
private:
	GLboolean loadReflectionMap(std::string rFileName);
	void loadRefImages();
	void configTexture();
	sf::Image heightMap;
	sf::Image texture;
	sf::Image *waterRef;
	GLubyte *topImage; //[1024][1024][3];
	GLubyte *farImage;
	GLubyte *bottomImage;
	GLubyte *rearImage;
	GLubyte *leftImage;
	GLubyte *rightImage;
	std::string filename;
	GLuint waterID;
	GLboolean imageLoaded; //Prevent rendering before loading
	Vertex *vertices;
	std::list<Normal*> *normalsByPosition;
	GLuint *indices;
    GLuint shaderProg;
	GLuint vboID;
	GLuint indicesVBOID;
	GLuint noIndices;
	GLuint numVertices;
	GLuint width;
	GLuint height;
    vec3 scale;
    vec3 position;
	GLuint texID;
};

#endif // WATER_H
